//
//  AXMyOrderdetailTopCell.m
//  AnXin100
//
//  Created by 天质弘耕 on 2018/10/25.
//  Copyright © 2018年 tzhg. All rights reserved.
//

#import "AXMyOrderdetailTopCell.h"
#import "UIView+SDAutoLayout.h"
#import "ZXCategories.h"
#import "UITableView+SDAutoTableViewCellHeight.h"

@interface AXMyOrderdetailTopCell ()
/** 线 */
@property (nonatomic , strong) UIView *lineView;

@end

@implementation AXMyOrderdetailTopCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self creatView];
        [self setlayout];
    }
    return self;
}

- (void)creatView {
    /** 收货人 */
    self.receiverLabel = [[UILabel alloc]init];
    self.receiverLabel.text = @"收货人：哆啦A梦";
    self.receiverLabel.textAlignment = NSTextAlignmentLeft;
    self.receiverLabel.font = FONT_FOURTEEN;;
    self.receiverLabel.textColor = COLOR_DIV;
    [self.contentView addSubview:self.receiverLabel];
    /** 电话*/
    self.telephoneLabel = [[UILabel alloc]init];
    self.telephoneLabel.text = @"18687832413";
    self.telephoneLabel.textAlignment = NSTextAlignmentLeft;
    self.telephoneLabel.font = FONT_FOURTEEN;;
    self.telephoneLabel.textColor = COLOR_DIV;
    [self.contentView addSubview:self.telephoneLabel];
    /** 收货地址*/
    self.addressLabel = [[UILabel alloc]init];
    self.addressLabel.text = @"收货地址：云南省昆明市盘龙区白云路";
    self.addressLabel.textAlignment = NSTextAlignmentLeft;
    self.addressLabel.font = FONT_FOURTEEN;;
    self.addressLabel.textColor = COLOR_DIV;
    [self.contentView addSubview:self.addressLabel];
    
    /** 店铺名 */
    self.storeNameLabel = [[UILabel alloc]init];
    self.storeNameLabel.text = @"大黄店铺";
    self.storeNameLabel.textAlignment = NSTextAlignmentLeft;
    self.storeNameLabel.font = FONT_FOURTEEN;;
    self.storeNameLabel.textColor = COLOR_DIV;
    [self.contentView addSubview:self.storeNameLabel];

    /** 产品图片 */
    self.productImageView = [[UIImageView alloc]init];
    self.productImageView.image = [UIImage imageNamed:@"j2.jpg"];
    self.productImageView.contentMode =UIViewContentModeScaleAspectFill;
    self.productImageView.clipsToBounds=YES;//
    [self.contentView addSubview:self.productImageView];
    /** 产品名字 */
    self.productNameLabel = [[UILabel alloc]init];
    self.productNameLabel.font = FONT_FOURTEEN;;
    self.productNameLabel.numberOfLines = 2;
    self.productNameLabel.textColor = [UIColor colorWithHex:0x666666];
    [self.contentView addSubview:self.productNameLabel];
    /** 产品合计 */
    self.productCountLabel = [[UILabel alloc]init];
    self.productCountLabel.textColor = [UIColor colorWithHex:0x666666];
    self.productCountLabel.font = FONT_TWELVE;
    self.productCountLabel.text = @"共10件商品 ";
    [self.contentView addSubview:self.productCountLabel];
    /** 产品价格 */
    self.priceLabel = [[UILabel alloc]init];
    self.priceLabel.text = @"￥98";
    self.priceLabel.textColor = COLOR_ORG;
    self.priceLabel.font = FONT_EIGHTEEN;
    [self.contentView addSubview:self.priceLabel];
    /** 买家留言 */
    self.leavewordLabel = [[UILabel alloc]init];
    self.leavewordLabel.textAlignment = NSTextAlignmentLeft;
    self.leavewordLabel.font = FONT_FOURTEEN;;
    self.leavewordLabel.textColor = COLOR_ORG;
    self.leavewordLabel.text = @"买家留言：希望送快点，保证质量!";
    [self.contentView addSubview:self.leavewordLabel];
    
    
    
}

- (void)setlayout {
    
    self.receiverLabel.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .topSpaceToView(self.contentView, 10)
    .widthIs((SCREEN_WIDTH-30)/2)
    .heightIs(30);
    
    self.telephoneLabel.sd_layout
    .rightSpaceToView(self.contentView, 10)
    .topSpaceToView(self.contentView, 10)
    .widthRatioToView(self.receiverLabel, 1)
    .heightRatioToView(self.receiverLabel, 1);
    
    self.addressLabel.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .topSpaceToView(self.receiverLabel, 10)
    .rightSpaceToView(self.contentView, 10)
    .heightIs(30);
    
    /** 店铺名称 */
    self.storeNameLabel.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .topSpaceToView(self.addressLabel, 10)
    .widthIs(SCREEN_WIDTH-100)
    .heightIs(30);
    /* 产品图片 **/
    self.productImageView.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .topSpaceToView(self.storeNameLabel,10)
    .widthIs(100)
    .heightIs(100);
    /** 产品名字 */
    self.productNameLabel.sd_layout
    .leftSpaceToView(self.productImageView, 10)
    .topSpaceToView(self.storeNameLabel,10)
    .rightSpaceToView(self.contentView, 10)
    .heightIs(30);
    
    /* 价格 **/
    self.priceLabel.sd_layout
    .leftSpaceToView(self.productImageView, 10)
    .topSpaceToView(self.productNameLabel,10)
    .widthIs(50)
    .heightIs(30);
    
    self.productCountLabel.sd_layout
    .rightSpaceToView(self.contentView, 10)
    .topSpaceToView(self.productNameLabel,10)
    .widthIs(100)
    .heightIs(30);
   
    self.leavewordLabel.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .topSpaceToView(self.productImageView, 10)
    .rightSpaceToView(self.contentView, 10)
    .heightIs(30);
    
  
    
    self.lineView = [[UIView alloc]init];
    self.lineView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self.contentView addSubview:self.lineView];
    
    self.lineView.sd_layout
    .rightSpaceToView(self.contentView, 0)
    .topSpaceToView(self.leavewordLabel, 10)
    .widthIs(SCREEN_WIDTH)
    .heightIs(10);
    
    /** cell高度自适应第一步 */
    [self setupAutoHeightWithBottomView:self.lineView bottomMargin:10];
    
}

@end


